package com.kongyz.mp3;

import com.kongyz.MediaAdapter;

/**
 * @author kongyz
 * @date 2018/6/23 23:46
 * @Description: 默认AudioPlayer 只能播放mp3的音频文件，
 *              现在通过适配器，让audioPlayer能播放高级的音频文件
 *
 */
public class AudioPlayer implements MediaPlayer {

    MediaAdapter mediaAdapter;

    public void play(String audioType, String fileName) {
        if(audioType.equalsIgnoreCase("mp3")){
            System.out.println("Audio正在播放："+fileName);
        }else if(audioType.equalsIgnoreCase("vlc")
                ||audioType.equalsIgnoreCase("mp4")){
            mediaAdapter=new MediaAdapter(audioType);
            mediaAdapter.play(audioType,fileName);
        }else {
            System.out.println("未找到"+audioType+"格式的播放器");
        }
    }
}
